<template>
  <div id="courselist"> 

          <el-table :data="datalist" style="width: 100%" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
           :row-class-name="tableRowClassName"  :border="true">


                <el-table-column label="日期"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.daytime }}</span>
                    </template>
                </el-table-column>  
                 <el-table-column label="每日文案"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.writing }}</span>
                    </template>
                </el-table-column>   
                <el-table-column label="图片"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span v-if="scope.row.icon">
                             <el-image 
                                style="width: 30px; height: 30px"
                                :src="urlimg + scope.row.icon" 
                                :preview-src-list="scope.row.iconlist" class="imga">
                            </el-image>
                        </span>
                        <span v-else>暂未上传</span> 
                    </template>
                </el-table-column> 

                 <el-table-column label="操作" align='center' width="300px">
                    <template slot-scope="scope"> 
                        <el-button size="mini"  type="primary" class="button_class1" plain @click="delete_but(scope.row)">删除</el-button> 
                    </template>
                </el-table-column>        

  
            </el-table>  







   </div>
</template>

<script>

export default {
   name: 'courselist',
   props:{
      datalist:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
        my_id:'',
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight -293
      
  },
  mounted (){
    
  },
  methods: {
   delete_but(row){

       this.$confirm('是否删除, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
         }).then(() => {

                this.post("/share/delete", {
                   id:row.id
                }).then(res => {

                    if(res.error_code == 0){
                        this.open1(res.result,'success')  //提示框
                        this.$emit('up_list_fun')

                    }else {
                     this.open1(res.message,'warning')
                    }
               })

        }).catch(() => {
            //  this.$emit('up_list_fun') 
        });
   
   },
     beforeupload(file){   //重新写入上穿 需要点击确认上传与表单一起提交
           if(this.upimglx(file) == false){  //判断是否为fales
              this.upimglxtitle()  //执行弹出错误             
              return false
            }  
            var windowURL = window.URL || window.webkitURL;               
            this.pic_form.head_img=windowURL.createObjectURL(file);             
            
            this.upimgpost("/image/uploadMultiple",file).then(res => {
              console.log(res.result.url )
               this.pic_form.upfile = res.result.url    
            })

            return false;
     },
      ImgUploadSectionFile(param){//图片上传    
      },



  }
}
</script>


<style scoped>
.imga>>>.el-icon-circle-close {
      color: white;
}
.avatar-uploader  {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 150px;
    height: 150px;
    line-height: 150px;
    text-align: center;
  }
  .avatar {
    width: 150px;
    height: 150px;
    display: block;
  }
</style>